package com.ovidiojf.timeTableGraph;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;

import com.ovidiojf.timeTable.Professor;


public class Cell extends JPanel {
    
	private static final long serialVersionUID = 1L;
	
	public Cell() {
        setBorder((Border) BorderFactory.createLineBorder(new Color(204, 204, 204)));
        setLayout(new BorderLayout());

        this.pnColor = new JPanel();
        this.label = new JLabel();

        this.pnColor.setPreferredSize(new Dimension(getPreferredSize().height, 5));
        
        this.label.setHorizontalAlignment(JLabel.CENTER);
        this.label.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
       
        add(this.pnColor, BorderLayout.WEST);
        add(this.label  , BorderLayout.CENTER);
    }

    public final void setValue(Professor prof) {
        label.setText(prof.getName());
    //  pnColor.setBackground(prof.getColor());
        
        setBorder((Border) BorderFactory.createLineBorder(prof.getColor()));
    }
    
    public final void setCaption(String s) {
    	label.setText(s);
    }
    
    private JLabel label;
    private JPanel pnColor;
}
